import 'package:flutter/material.dart';
import '/components/page/common.dart';
import '/components/user_basic_info.dart';
import '/components/list/route_menu_item.dart';
import '/components/custom/divider.dart';
import '/components/custom/full_center_button.dart';
import '/utils/load_image.dart';
import '/config/base_url.dart';

// 联系人列表点击，进入的联系人信息页
class FriendInfoPage extends StatelessWidget {
  const FriendInfoPage({super.key});

  @override
  Widget build(BuildContext context) {
    return const CommonPage(
      appBarBgColor: Colors.white,
      child: FriendInfoWidget(),
    );
  }
}

class FriendInfoWidget extends StatelessWidget {
  const FriendInfoWidget({super.key});

  @override
  Widget build(BuildContext context) {

    double imgSize = 46.0;
    Widget albumsList = Row(
      children: [
        const SizedBox(width: 20.0),
        loadImageByUrl('$baseUrl/avatar/tx49.jpg', imgSize, imgSize),
        const SizedBox(width: 6.0),
        loadImageByUrl('$baseUrl/avatar/tx51.jpg', imgSize, imgSize),
        const SizedBox(width: 6.0),
        loadImageByUrl('$baseUrl/avatar/tx52.jpg', imgSize, imgSize),
        const SizedBox(width: 6.0),
        loadImageByUrl('$baseUrl/avatar/tx53.jpg', imgSize, imgSize),
      ]
    );

    return Column(
      children: [
        const UserBasicInfoWidget(showNickName: true),
        const DividerLine(),
        RouteMenuItem(
          title: '标签',
          hasBottom: false,
          onTap: () {},
        ),
        RouteMenuItem(
          title: '朋友权限',
          onTap: () {
            Navigator.pushNamed(context, 'EmptyPage', arguments: {
              'title': '朋友权限',
            });
          },
        ),
        RouteMenuItem(
          title: '朋友圈',
          hasBottom: false,
          customCenterWidget: albumsList,
          onTap: () {
            Navigator.pushNamed(context, 'FriendsCirclePage');
          },
        ),
        RouteMenuItem(
          title: '更多信息',
          onTap: () {
            Navigator.pushNamed(context, 'EmptyPage', arguments: {
              'title': '更多信息',
            });
          },
        ),

        FullCenterButton(
          iconName: Icons.message,
          text: '发消息',
          onTap: () {
            Navigator.pushNamed(context, 'ChatWindowPage', arguments: {
              'userName': '雪华',
            });
          },
        ),
        const DividerLine(),
        FullCenterButton(
          iconName: Icons.videocam_rounded,
          text: '音视频通话',
          onTap: () {
            ScaffoldMessenger.of(context).showSnackBar(
              const SnackBar(
                content: Text('这是一个轻提示信息'),
                duration: Duration(seconds: 2),
              ),
            );
          },
        ),
      ],
    );
  }
}
